/* Team Directories
 *
 * You are free to do whatever you want with this code. Frankly we don't give a damn.
 * 
 *  
 * Copyright GNU General Public License v3
 */

package BackupClasses;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Ra
 */
import java.io.*;
public class ReadWrite {
    
    public String Read(String file)
    {
        BufferedReader inputStream = null;
        String line = null;
        try
        {
            inputStream = new BufferedReader(new FileReader(file));
            line = inputStream.readLine();
            //inputStream.close();
        }
        catch(FileNotFoundException e)
        {
            System.out.println("File " + file + "was not found.");
        }
        catch(IOException e)
        {
            System.out.println("Error reading from file " + file +".");
        }
        
        return line;
    }//Read
    public void Write(String line, String file)
    {
       PrintWriter outputStream = null;
       try
       {
           outputStream = new PrintWriter(new FileOutputStream(file,true));
           System.out.println(line);
       }
       catch(FileNotFoundException e)
       {
           System.out.println("Error opening the " + file + ".");
           System.exit(0);
       }
       outputStream.println(line);
       outputStream.close();
       
    }

}//ReadWrite

